package com.briup.service;

import com.briup.bean.Teacher;
import com.briup.dao.ITeacherDAO;
import com.briup.exception.TeacherException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * service层接口的实现类
 */
//<bean></bean>
@Service  //spring扫描 service包中注解 根据注解位置类创建该对象 IOC容器
public class TeacherServiceImpl implements ITeacherService{
    @Autowired
    private ITeacherDAO dao;// dao = new TeacherDAOimpl();
    @Override
    public Teacher findTeacherById(Integer id) throws Exception {
        if(id == 0){
            throw new TeacherException("工号不存在为0的情况");
        }
        if(id == 1){
            System.out.println(1/0);
        }
        return dao.findTeacherById(id);
    }
}
